(* File lexer.mll *)

{
open Parser        (* The type token is defined in parser.mli *)
}

rule token = parse
	[' ' '\t' '\n']			{ token lexbuf }     (* skip blanks *)
	| "-1"						{ TokenEnd }
	| ['0'-'9']+        		{ TokenInt(int_of_string(Lexing.lexeme lexbuf)) }
	| 't'							{ TokenT }
	| 'f'							{ TokenF }
	| 'p' ['0'-'9']+       	{ TokenProp(Lexing.lexeme lexbuf) }
	| '!'							{ TokenNot }
	| '&'							{ TokenAnd }
	| '|'            			{ TokenOr }
	| 'i'							{ TokenImp }
	| 'e'							{ TokenEq }
	| '^'							{ TokenNeq }
	| eof            			{ TokenEof }
	| _							{ token lexbuf }     (* skip rest *)